#include<bits/stdc++.h>
using namespace std;

const int maxn = 1e5;

bool is[maxn + 5];

signed main() {

	memset(is, true, sizeof is);
	is[0] = is[1] = 0;

	for (int i = 2; i <= maxn; i++) {
		if (is[i]) {
			for (int j = 2 * i; j <= maxn; j += i) {
				is[j] = 0;
			}
		}
	}

	int l, r, ans = 0;
	cin >> l >> r;
	for (int i = l; i <= r; i++) {
		ans += is[i];
	}
	cout << ans;

	return 0;
}
